/**
 * 
 */
package org.flycloud.web.platform.dao;

import java.util.List;

import org.flycloud.web.platform.entity.Organization;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * 
 * @author zhangbo
 * @since 2013年10月16日 上午9:04:23
 *
 */
public interface OrganizationDao extends JpaRepository<Organization, Long> {
	
	Organization findByParentIdAndName(Long parentId, String name);

	List<Organization> findByParentId(Long parentId);

	/**
	 * @param id
	 * @param name
	 * @param id2
	 */
	Organization findByParentIdAndNameAndIdNot(Long parentId, String name, Long id);

	Organization findByCode(String code);

	@Query("select o from Organization o where code like '3706__'")
	List<Organization> findAllTop();
}
